﻿namespace Fiuba.Algo3.Titiritero.Vista
{
    using System;
    using System.Drawing;
using System.Windows.Forms;

    public class Panel : System.Windows.Forms.Panel, ISuperficieDeDibujo
    {
        public Panel()
        {
            this.DoubleBuffered = true;
            //this.Limpiar();
        }

        /// <summary>
        /// Debido a la forma en que trabajar WindowsForms no resulta necesario implementar actualizar
        /// pues el canvas se actualiza of the fly.
        /// </summary>
        public void Actualizar()
        {}

        public void Limpiar()
        {
            using (SolidBrush brocha = new SolidBrush(System.Drawing.Color.Silver))
            {
                var g = this.CreateGraphics();
                g.FillRectangle(brocha, 0, 0, this.Width, this.Height);
            }
        }

        public Object Buffer
        {
            get
            {
                return this.CreateGraphics();
            }
        }

        public Panel(int ancho, int alto, ControladorJuego unControlador)
        {
            ////this.addMouseListener(new MouseClickController(unControlador));
            //this.addKeyListener(new KeyPressedController(unControlador));
            this.Height = alto;
            this.Width = ancho;
        }

        public Panel(int ancho, int alto)
        {
            this.Width = ancho;
            this.Height = alto;
        }

    }
}
